import { lazy } from 'react'
import { createBrowserRouter } from 'react-router-dom'
import App from '../App'

const Home = lazy(() => import('../pages/home/Index'));

const Index = lazy(() => import('../pages/index/Index'));
const Class = lazy(() => import('../pages/class/Index'));

export const homeRouter = [
    {
        path: '/home/index',
        element: <Index></Index>,
        title: '首页'
    },
    {
        path: '/home/class',
        element: <Class></Class>,
        title: '分类'
    }
]

const router = createBrowserRouter([
    {
        path: '/',
        element: <App></App>,
        children: [
            {
                index: true,
                element: <Home></Home>
            },
            {
                path: '/home',
                element: <Home></Home>,
                children: homeRouter
            }
        ]
    }
]);
export default router